package com.dongdongshop.controller;

import com.dongdongshop.domain.AjaxResult;
import com.dongdongshop.pojo.TbItemCat;
import com.dongdongshop.service.ItemcatService;
import em.ResuleEnum;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("itemcat")
public class ItemcatController {

    @DubboReference
    private ItemcatService itemcatService;

    @RequestMapping("itemcatShow")
    public String itemcatShow(){
        return "admin/item_cat";
    }

    @RequestMapping("itemcatList")
    @ResponseBody
    public AjaxResult itemcatList(Long id){
        List<TbItemCat> list = itemcatService.itemcatList();
        return AjaxResult.R(ResuleEnum.SUCCESS).setData(list);
    }

    @RequestMapping("querysubordinate")
    @ResponseBody
    public AjaxResult querysubordinate(Long id){
        List<TbItemCat> list = itemcatService.querysubordinate(id);
        return AjaxResult.R(ResuleEnum.SUCCESS).setData(list);
    }

    @RequestMapping("getdaoh")
    @ResponseBody
    public AjaxResult getdaoh(Long id){
        List<TbItemCat> list = itemcatService.getdaoh(id);
        return AjaxResult.R(ResuleEnum.SUCCESS).setData(list);
    }

    @RequestMapping("selectById")
    @ResponseBody
    public AjaxResult selectById(Long id){
        TbItemCat tbItemCat = itemcatService.selectById(id);
        return AjaxResult.R(ResuleEnum.SUCCESS).setData(tbItemCat);
    }

    @RequestMapping("updateInfo")
    @ResponseBody
    public AjaxResult updateInfo(TbItemCat tbItemCat){
        itemcatService.updateInfo(tbItemCat);
        return AjaxResult.R(ResuleEnum.SUCCESS);
    }

    @RequestMapping("insertInfo")
    @ResponseBody
    public AjaxResult insertInfo(TbItemCat tbItemCat){
        itemcatService.insertInfo(tbItemCat);
        return AjaxResult.R(ResuleEnum.SUCCESS);
    }

    @RequestMapping("deletedd")
    @ResponseBody
    public AjaxResult deletedd(Long id){
        itemcatService.deletedd(id);
        return AjaxResult.R(ResuleEnum.SUCCESS);
    }
}
